home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d27 / excsrc.arc / EXCSRC.TXT next >
Text File  |  1991-12-04  |  3KB  |  62 lines

  1. The OPNQRYF command has made us change the way we design some of our
  2. applications.  Most of our query situations are standardized report
  3. programs with the selection criteria being the only variable.  This
  4. means the query has to run in batch after some sort of interactive
  5. application has formatted the request.  Since we did not want to create
  6. a CL program for each request, we tried creating the job stream in a
  7. source file and using the STRDBRDR command to start the batch job.
  8. This worked, but it didn't give the interactive user much control over
  9. the batch job via the DSPSBMJOB command.  By using the following
  10. command, we can now use SBMJOB with EXCSRCJOB as the RQSDTA and it
  11. works as if the user requested a compiled program.  In development, is
  12. very easy to construct a OPNQRYF job stream in QCLSRC and run it using
  13. option 6 of the programmers menu with EXCSRCJOB QCLSRC.library member
  14. on the command line.  It also gets around the 256 character restriction
  15. of RQSDTA.
  16.  
  17. Bob Hughes, Pandols (805)725-3755
  18.  
  19. Command source--------------------------------------------------------
  20.              CMD        PROMPT('EXeCute SouRCe member JOB')
  21.              PARM       KWD(FILE) TYPE(QUAL1) MIN(1) PROMPT('Source +
  22.                           file')
  23.              PARM       KWD(MEMBER) TYPE(*NAME) LEN(10) MIN(1) +
  24.                           PROMPT('Source member name')
  25.  QUAL1:      QUAL       TYPE(*NAME) LEN(10) MIN(1)
  26.              QUAL       TYPE(*CHAR) LEN(10) DFT(*LIBL) +
  27.                           PROMPT('Library')
  28.  
  29. Command processing source---------------------------------------------
  30.              PGM        PARM(&FILE &MBR)
  31.              DCLF       FILE(QCLSRC.QGPL)
  32.              DCL        VAR(&FILE) TYPE(*CHAR) LEN(20)
  33.              DCL        VAR(&FNAM) TYPE(*CHAR) LEN(10)
  34.              DCL        VAR(&FLIB) TYPE(*CHAR) LEN(10)
  35.              DCL        VAR(&MBR) TYPE(*CHAR) LEN(10)
  36.              DCL        VAR(&MSGID ) TYPE(*CHAR) LEN( 7)
  37.              DCL        VAR(&MSGF  ) TYPE(*CHAR) LEN(10)
  38.              DCL        VAR(&MSGDTA) TYPE(*CHAR) LEN(100)
  39.              DCL        VAR(&MSGFLIB) TYPE(*CHAR) LEN(10)
  40.              MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR))
  41.              CHGVAR     VAR(&FNAM) VALUE(%SST(&FILE 1 10))
  42.              CHGVAR     VAR(&FLIB) VALUE(%SST(&FILE 11 10))
  43.              OVRDBF     FILE(QCLSRC) TOFILE(&FNAM.&FLIB) MBR(&MBR)
  44.  LOOP:       RCVF
  45.              MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(EXIT))
  46.              SNDPGMMSG  MSG(&SRCDTA) TOPGMQ(*EXT) MSGTYPE(*RQS)
  47.              GOTO       CMDLBL(LOOP)
  48.  EXIT:       CHGJOB     LOGCLPGM(*YES)
  49.              TFRCTL     PGM(QCL.QSYS)
  50. /* Error handling routine to receive any *ESCAPE messages and resend  +
  51.    them to the user and then end with a CPF9898 *ESCAPE message      */
  52.  ERROR:      RCVMSG     MSGDTA(&MSGDTA) MSGID(&MSGID) MSGF(&MSGF) +
  53.                           MSGFLIB(&MSGFLIB)
  54.              IF         COND(&MSGID *EQ ' ') THEN(GOTO CMDLBL(FAIL))
  55.              SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGF.&MSGFLIB) +
  56.                           MSGDTA(&MSGDTA) MSGTYPE(*INFO)
  57.              GOTO       CMDLBL(ERROR)
  58.  FAIL:       SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG.QSYS) MSGDTA('The +
  59.                           SBMSRCJOB command failed to complete, +
  60.                           review prior messages') MSGTYPE(*ESCAPE)
  61.              ENDPGM
  62.